package com.insurance.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import com.insurance.common.enums.LoginStateEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang.StringUtils;

/**
 * 合作方登录日志
 * 
 * @date 2021-02-26 17:32:47
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("partner_login_log")
public class PartnerLoginLogEntity implements Serializable {

	private static final long serialVersionUID = 1L;

	/**
	 * $column.comments
	 */
	@TableId
	private String logId;
	/**
	 * $column.comments
	 */
	private String appId;
	/**
	 * $column.comments
	 */
	private Date loginTime;
	/**
	 * $column.comments
	 */
	private String loginState;
	/**
	 * $column.comments
	 */
	private String requestData;
	/**
	 * $column.comments
	 */
	private String responseData;

	@TableField(exist=false)
	private String logIdText;

	@TableField(exist=false)
	private String loginStateText;

	public String getLogIdText() {
		return this.logId != null ? String.valueOf(this.logId) : "";
	}

	public String getLoginStateText() {
		return LoginStateEnum.getMessage(this.loginState);
	}

	public PartnerLoginLogEntity(String appId, Date loginTime, String loginState, String requestData){
		this.appId = appId;
		this.loginTime = loginTime;
		this.loginState = loginState;
		this.requestData = requestData;
	}

}
